package com.atguigu.cloud.controller;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

import java.io.BufferedReader;
import java.io.IOException;

/**
 * ClassName: MyRequestOriginParser
 * Package: com.atguigu.cloud.controller
 * Description:
 * Author: 雷建国
 * Create: 2024/3/25 19:28
 * Version: 1.0
 */
@Component
public class MyRequestOriginParser implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest request){
        // 获取请求的IP地址
        String ipAddress = request.getRemoteAddr();

        return ipAddress;
//      return "fail";
    }
}
